<?php

namespace app\admin\validate;

use app\common\validate\AdminValidate;
use think\Validate;

class Admin extends AdminValidate
{
    protected $rule = [
        'username' => 'require|min:3|max:20|unique:admin',
        'mobile' => 'require|mobile|unique:admin',
        'email' => 'email|unique:admin',
        'password' => 'require|min:8|max:16|regex:/(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*[\W_]).{8,16}/',
        'confirmPassword' => 'require|confirm:password',
    ];

    protected $message = [
        'password.require' => '请输入新密码',
        'confirmPassword.require' => '请输入确认密码',
        'confirmPassword.confirm' => '两次输入密码不一致',
    ];

    protected $scene = [
        'updatePassword' => [
            'password',
            'confirmPassword',
        ]
    ];
}
